<template>
  <div>
    <Top></Top>
    <TopNav></TopNav>
    <BorderTitle>热门歌手</BorderTitle>
    <template>
        
      <div v-for="i in list" :key="i.id" class="listimg"  >
        <router-link :to ="`/songlist/${i.id}`"> 
         <img :src="i.picUrl" />
        </router-link>
       
        <div class="listname">
          {{ i.name }}
        </div>
        <span>
          <img src="../assets/yonghu.svg" alt="" />
        </span>
        <div class="listright">+ 关注</div>
      </div>
    </template>
    <div class="button">
      <div class="propMore " @click="propMore">上一页</div>
      <div class="loadingmore" @click="loadMore">下一页</div>
            
    </div>
  </div>
</template>
<script>
import BorderTitle from "@/components/BorderTitle";
import TopNav from "@/components/TopNav";
import Top from "@/components/Top";
export default {
  name: "Song",
  props:['item'],
  components: {
    BorderTitle,
    Top,
    TopNav
  },
  data() {
    return {
      list: [],
      page: 1,
      isLoading: true,
    };
  },

  created() {
    this.loadMusic();
  },

  methods: {
    loadMusic() {
      this.$http.get("/toplist/artist").then((data) => {
        console.log(data);
        this.list = data.data.list.artists.slice(
          (this.page - 1) * 20,
          20 * this.page
        );
        console.log(this.list);
      });
    },
    loadMore() {
      this.page++;
      if (this.page >= 10) {
        return false;
      }
      this.isLoading = true;
      this.loadMusic();
    },
    propMore() {
      this.page--;
      if (this.page >= 10) {
        return false;
      }
      this.isLoading = true;
      this.loadMusic();
    },
  },
};
</script>
<style lang="less" scoped>
.listimg {
  display: flex;
  flex: 1;
  margin-top: 15px;
  margin-left: 6px;
  position: relative;
  img {
    width: 55px;
    height: 55px;
    border-radius: 50%;
  }
  .listname {
    line-height: 60px;
    margin-left: 10px;
  }
  span {
    width: 20px;
    height: 20px;
    color: red;
  }
  .listright {
    position: absolute;
    right: 16px;
    top: 30px;
    border: 1px solid #ccc;
    width: 60px;
    text-align: center;
    border-radius: 20px;
    font-size: 12px;
    color: #ccc;
    line-height: 30px;
  }
}
.button {
    height: 60px;
    display: flex;    
    margin-top: 20px;
    position: relative;
}
.propMore,.loadingmore {
    border: 1px solid #ccc;
    width: 60px;
    height: 30px;
    line-height:26px;
    text-align: center;
    border-radius: 20px;
    font-size: 12px;
    color: #ccc;
   margin-left: 90px; 
  }
.iconfont{
    
    position: absolute;
    top: 86px;
    right: 30px;
    z-index: 8;
    text-decoration: none;
    color: #333;
  }
</style>